cmake_minimum_required (VERSION 2.8)

project(libdatastruct)
include_directories(./include)
include_directories(../common/include)
include_directories(../memory/include)
include_directories(../strings/include)

#aux_source_directory(./source ../common/source DIR_LIB_SRCS)
FILE(GLOB_RECURSE DIR_LIB_SRCS  "./source/*.c" "../memory/source/*.c" "../common/source/*.c" "../strings/source/*.c")
#aux_source_directory(../source )
# 生成链接库

# 默认生成 lib
#cmake -DTARGET_LIB:STRING=exe
if(TARGET_LIB STREQUAL "exe")
    add_executable(datastruct ${DIR_LIB_SRCS})
else()
    list(REMOVE_ITEM DIR_LIB_SRCS ./source/test_main.c)
    message ( ${DIR_LIB_SRCS})
    add_library (datastruct ${DIR_LIB_SRCS})
endif()


